<?php
//by willson 105328468@qq.com 2014/10/11
//index page interface

class notifytemplate_model extends base_model {
	public function __construct() {
		parent::__construct();
	}

	public function fetch($template_name, $params=array()) {
		$output = "";
		if ($template_name) {
			$sql = "SELECT content FROM {$this->tbp}config WHERE name='{$template_name}'";
			$template = $this->db->get_var($sql);
			if ($template) {
				if ($params) {
					//print_r($params);
					foreach ($params as $key => $value) {
						$this->smarty->assign($key, $value);
					}
				}
				$output = $this->smarty->fetch("string:".$template);
			}
		}
		return $output;
	}
}
